<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">

<link href="style.css" rel="stylesheet" type="text/css" media = "screen">
<link href="print.css" rel="stylesheet" type="text/css" media = "print">

</head>
<body>
<div id = "wrapper">

<div id = "container">
	<h1 class = "header">รายงานผลการประเมิน</h1>
	<br>
	<div class = "center" id = "report">
		<button class="print" onclick="javascript:window.print()">พิมพ์รายงาน</button>
		<h2>รายงานผลการบรรลุเป้าหมาย</h2>
		<?
			$grand_total_target = 0;
			$grand_total_result = 0;
		?>
		{loop="group"}
		<table cellpadding = "0" cellspacing = "0" border = "0" class = "list">
			<tr>
				<th colspan = "4">{$value.name}</td>
			</tr>
			<tr class = "head">
				<td class = "w350">ตัวบ่งชี้</td>
				<td class = "w80">เป้าหมาย</td>
				<td class = "w80">ผลการดำเนินงาน</td>
				<td class = "w80">ผลการบรรลุ</td>
			</tr>
			<?
				$total_target = 0;
				$total_result = 0;
			?>
			{loop="all_assessment"}
				{if="$value1.id==$value2.gid"}
					<?
						$total_target += $value2['target'];
						$total_result += $value2['result'];
						$grand_total_target += $value2['target'];
						$grand_total_result += $value2['result'];
					?>
					<tr>
						<td>ตัวบงชี้ {$value2.gid}.{$value.sub} {$value2.name}</td>
						<td>{$value2.target}</td>
						<td>{$value2.result}</td>
						<td>{if="$value2.target <= $value2.result"}บรรลุ{else}ไม่บรรลุ{/if}</td>
					</tr>
				{/if}
			{/loop}
			<tr>
				<td class = "head">รวม</td>
				<td class = "bg">{$total_target}</td>
				<td class = "bg">{$total_result}</td>
				<td class = "bg"></td>
			</tr>
		</table>
		{/loop}
		<table cellpadding = "0" cellspacing = "0" border = "0" class = "list">
			<tr>
				<td class = "head w350" style = "font-size:14px;">รวมทั้งหมด</td>
				<td class = "bg w80" style = "font-size:14px;">{$grand_total_target}</td>
				<td class = "bg w80" style = "font-size:14px;">{$grand_total_result}</td>
				<td class = "bg w80" style = "font-size:14px;"></td>
			</tr>
		</table>
	</div>

	<div class = "clear"></div>
</div>

</div> <!-- wrapper -->

</body>
</html>